package com.zmn.oms.dubbo.impl.normal.order;

import com.zmn.common.dto2.ResponseDTO;
import com.zmn.oms.common.dro.normal.order.OrderIncomeDetailDRO;
import com.zmn.oms.dubbo.interfaces.normal.order.OrderIncomeListRemoteService;
import com.zmn.oms.dubbo.utils.DubboConsts;
import com.zmn.oms.zmn.business.interfaces.work.ZsOrderWorkQueryBService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Service;

import javax.annotation.Resource;

/**
 * 类描述：订单收入
 *
 * @author ligang
 * @since 2022/07/27 14:20
 */
@Slf4j
@Service(loadbalance = "roundrobin", timeout = 10000, retries = 0, version = DubboConsts.INTERFACE_VERSION, validation = "true")
public class OrderIncomeListRemoteServiceImpl implements OrderIncomeListRemoteService {
    @Resource
    private ZsOrderWorkQueryBService zsOrderWorkQueryBService;

    @Override
    public ResponseDTO<OrderIncomeDetailDRO> getOrderIncomeDetailByOrderIdAndWorkId(Long orderId, Long workId) {
        log.info("#OrderIncomeListRemoteServiceImpl#getOrderIncomeDetailByOrderIdAndWorkId 入参：orderId={} workId={}", orderId, workId);
        try {
            OrderIncomeDetailDRO orderIncomeDetail = zsOrderWorkQueryBService.findOrderIncomeDetail(orderId, workId);
            return ResponseDTO.success(orderIncomeDetail);
        } catch (Exception e) {
            log.error("#OrderIncomeListRemoteServiceImpl#getOrderIncomeDetailByOrderIdAndWorkId：[{}]", orderId, e);
            return ResponseDTO.fail();
        }
    }
}
